<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<br>
<form class="form-horizontal" role="form">
    <div class="form-group">
        <!--<label for="inputEmail3" class="col-sm-2 control-label">账号:</label>-->
        <div class="col-sm-10">
            <input type="text" name="name" class="form-control" id="inputEmail3" placeholder="账号:"/>
        </div>
    </div>
    <div class="form-group">
        <!--<label for="inputPassword3" class="col-sm-2 control-label">密码:</label>-->
        <div class="col-sm-10">
            <input type="password" name="password" class="form-control" id="inputPassword3" placeholder="密码:"/>
        </div>
    </div>
    <div class="form-group">
        <div class="col-sm-offset-2 col-sm-10">
            <div class="checkbox">
                <label><input type="checkbox"/>记住我!</label>
            </div>
        </div>
    </div>
    <div class="form-group">
        <div class="col-sm-offset-2 col-sm-10">
            <input type="button" class="btn btn-default" onclick="login_btn();" value="登录">
            <input type="button" id="btn_register" class="btn btn-default" value="注册">
        </div>
    </div>
</form>

<script>
    $(document).ready(function () {
        $('#btn_register').click(function () {
            $('#viewDiv').load('register.html')
        })
    })



    function login_btn() {
        $('#form_login').ajaxSubmit({
            type:"post",
            url:"/user/login",
            success: function (data) {
                if (data){
                    //登录成功
                    alert("登录成功")
                    window.location.href = "a/main.html";
                } else {
                    //登录失败
                    alert('登录失败')

                }
            }
        })
    }
</script>

</body>
</html>